<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{margin:0;padding:0}
        .content{
            text-align: center;
            width:400px;
            margin:200px auto;
        }
        .bg{
            border-radius: 50%;
            animation: animate 2s linear infinite;
            animation-play-state: paused;
        }
        .play-btn{
            width:100px;
        }
        @keyframes animate {
            0%{
                transform: rotate(0deg);
            }
            100%{
                transform: rotate(360deg);
            }
        }
        .content{
            position: relative;
        }
        .play-item{
            position: absolute;
            width:111px;
            z-index: 100;
            left:50%;
            top:-80px;
            transform: rotate(-40deg);
            transform-origin:30px 30px ;
            /* animation-fill-mode:forwards|backwards 设置动画停止的位置 */
        }
        .play-music{
            animation: play 2s linear;
            animation-fill-mode: forwards;
        }
        .pause-music{
            animation: pause 2s linear;
            animation-fill-mode: forwards;
        }
        @keyframes play{
            0%{
                transform:rotate(-40deg)
            }
            100%{
                transform:rotate(-10deg)
            }
        }
        @keyframes pause{
            0%{
                transform:rotate(-10deg)
            }
            100%{
                transform:rotate(-40deg)
            }
        }
    </style>
    <script src="lib/jquery-3.2.1.js"></script>
</head>
<body>
    <div class="content">
        <img class="play-item" src="images/play-item.png" alt="">
        <img class="bg" src="images/bg.png" alt="">
        <img class="play-btn" src="images/pause.png" alt="">
    </div>
    <script>
        /* 1.定位isPlay控制音乐播放的状态 */
        var isPlay = false;
        $(".play-btn").click(function(){
            if(isPlay){
                isPlay = false
                $(this).attr("src","images/pause.png")
                $(".bg").css({"animationPlayState":"paused"})
                $(".play-item").addClass("pause-music").removeClass("play-music")
            }else{
                isPlay = true;
                $(this).attr("src","images/play.png")
                $(".bg").css({"animationPlayState":"running"})
                $(".play-item").addClass("play-music").removeClass("pause-music")
            }
        })
    </script>
</body>
</html>